import 'entity_factory.dart';

class BaseEntity<T> {
  int ret;
  T data;
  String code;
  String message;

  BaseEntity({this.ret, this.data, this.code, this.message});

  factory BaseEntity.fromJson(json) {
    return BaseEntity(
      ret: json["ret"],
      // data值需要经过工厂转换为我们传进来的类型
      data: EntityFactory.generateOBJ<T>(json["data"]),
      code: json["code"].toString(),
      message: json["message"],
    );
  }
}